package com.lagou.boot;

import com.lagou.client.RPCConsumer;
import com.lagou.register.ServiceRegister;
import com.lagou.service.IUserService;

public class ConsumerBoot {

    // 参数定义
    private static final String PROVIDER_NAME = "UserService#sayHello#";

    public static void main(String[] args) throws InterruptedException {

        // 1.客户端与每一个服务端都建立连接
        ServiceRegister.initClient();

        // 2.创建代理对象
        IUserService service = (IUserService)RPCConsumer.createProxy(IUserService.class, PROVIDER_NAME);

        // 3.循环给服务器写数据
        while (true) {
            String result = service.sayHello("are you ok !!");
            System.out.println(result);
            Thread.sleep(2000);
        }

    }
}
